package com.utooo.pojo.enums;

/**
 * 采购任务管理状态枚举
 */
public enum PurchaseTaskStatus {
    PENDING_ACCEPTANCE("1", "待受理"),
    ACCEPTED("2", "受理完成"),
    CLOSED("3", "关闭"),
    CHANGING("4", "变更中"),
    PARTIALLY_ACCEPTED("5", "部分受理");

    private final String code;
    private final String description;

    PurchaseTaskStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static PurchaseTaskStatus fromCode(String code) {
        for (PurchaseTaskStatus status : PurchaseTaskStatus.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }
}
